<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        input {
            border-bottom-style: inset;
            border-top-style: none;
            border-left-style: none;
            border-right-style: none;
        }

        td {
            padding-left: 2px;
            padding-right: 2px;
            padding-top: 6px;
            padding-bottom: 6px;
        }

        td {
            padding: 4px;
        }
        .printBody {
            width: 80%;
            margin-left: 3%;
        }

        .container {
            text-align: left;
            width: 100%;
        }

        .printBody {
            width: 210mm;
            height: 297mm;
            margin: 0 auto;
        }

        .container {
            text-align: left;
            width: 100%;
            font-size: 14px;
        }

        .smtz_span {
            display: inline-block;
            width: 110px;
        }


        .hhl_button {
            position: relative;
            float: right;
            right: 5%;
            padding-top: 20px;
        }

        .save_button {
            margin-right: 50px;
        }

        .csygqk_label {
            font-size: 13px;
            position: relative;
            top: -2px;
        }

        .csygql_contain td {
            padding-top: 10px;
            padding-bottom: 10px;
        }
        .ty_table{
            width: 100%;
            word-wrap: break-word;
            word-break: break-all;
            table-layout: fixed;
        }
        .ty_input{
            width: 120px;
        }
        .rqqyyqk_input{
            width:110px;
        }
        .fgx{
            width: 100%;
        }
    </style>
    <script src="/static/js/jquery.js"></script>
    <script src="/static/js/LodopFuncs.js"></script>
    <script src="/static/js/html2canvas.js"></script>
</head>
<body>
<div id="printBody" class="printBody">
    <div style="width: 100%;">
        <div class="title" style="text-align: center;">
            <h1>急诊创伤记录表</h1>
        </div>
        <div class="container">
            <div>
                <table class="ty_table">
                    <tr>
                        <td>
                            <span>姓名:<span id="name"></span></span>
                        </td>
                        <td>
                            <span>性别:<span id="sex"></span></span>
                        </td>
                        <td>
                            <span>年龄:<span id="age"></span></span>
                        </td>
                        <td>
                            <span>病床:<span id="bednum2"></span></span>
                        </td>
                        <td>
                            <span>病案号:<span id="innum"></span></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td colspan="10">
                            <span>单位/地址:&nbsp;<input type="text" maxlength="50" name="dwdz" id="dwdz" class="qt_input" style="width: 70%"/></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td colspan="3">
                            <span>就诊时间:&nbsp;&nbsp;</span>
                            <input type="text" class="ty_input" id="jzsj" name="date">
                        </td>
                        <td colspan="6">
                            <span>首诊科室:</span>
                            <input type="text" class="ty_input" id="szks" name="szks"/>
                            &nbsp;
                            <span>首诊医生:</span>
                            <input type="text" class="ty_input" id="szys" name="szys"/>
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td colspan="6">
                            <span>入抢方式:</span>
                            <div style="display: inline">
                                <input type="radio" id="walk" name="rqfs" value="0" checked><label for="walk">步行</label>
                            </div>
                            <div style="display: inline;padding-left: 30px">
                                <input type="radio" id="wheelchair" name="rqfs" value="1"><label
                                    for="wheelchair">轮椅</label>
                            </div>
                            <div style="display: inline;padding-left: 30px">
                                <input type="radio" id="flatCar" name="rqfs" value="2"><label for="flatCar">平车</label>
                            </div>
                            <div style="display: inline;padding-left: 30px">
                                <input type="radio" id="rqfsfx" name="fx" value="2"><label for="rqfsfx">扶行</label>
                            </div>
                            <div style="display: inline;padding-left: 30px">
                                <input type="radio" id="rqfsqt" name="rqfsqt" value="2"><label for="rqfsqt">其他</label>
                            </div>
                        </td>
                        <td colspan="4">
                            <span>入抢诊断:</span>
                            <input type="text" id="rqzd" name="rqzd" class="ty_input"/>
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td colspan="5">
                            <span>既往病史:</span>
                            <div style="display: inline">
                                <input type="radio" id="jwbswu" name="jwbs" value="jwbswu" checked><label for="jwbswu">无</label>
                            </div>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <div style="display: inline">
                                <input type="radio" id="jwbsyou" name="jwbs" value="jwbsyou"><label for="jwbsyou">有</label>
                                <input type="text" id="jwbsynr" class="qt_input" name="jwbsynr" style="width: 80px"/>
                            </div>
                        </td>
                        <td colspan="5">
                            <span>过敏史:</span>
                            <div style="display: inline">
                                <input type="radio" id="gmswu" name="gms" value="gmswu" checked><label for="gmswu">无</label>
                            </div>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <div style="display: inline">
                                <input type="radio" id="gmsyou" name="gms" value="gmsyou"><label for="gmsyou">有</label>
                                <input type="text" id="gmsynr" class="qt_input" name="gmsynr" style="width: 80px"/>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td colspan="8">
                            <span>入抢前用药情况:</span>
                            <div style="display: inline">
                                <input type="radio" id="rqqyyqkwu" name="rqqyyqk" checked value="rqqyyqkwu"><label
                                    for="rqqyyqkwu">无</label>
                            </div>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <div style="display: inline">
                                <input type="radio" id="rqqyyqkyou" name="rqqyyqk" value="rqqyyqkyou"><label
                                    for="rqqyyqkyou">有</label>
                                <input type="text" id="ryqyyqkynr" class="rqqyyqk_input" name="ryqyyqkynr"/>
                            </div>
                        </td>
                        <!--                    <td colspan="12">-->
                        <!--                        <span>紧急联系人:</span>-->
                        <!--                        <input type="text" class="rqqyyqk_input" id="jjlxr" name="jjlxr"/>-->
                        <!--                        &nbsp;-->
                        <!--                        <span>电话:</span>-->
                        <!--                        <input type="text" class="rqqyyqk_input" id="dh" name="dh"/>-->
                        <!--                    </td>-->
                    </tr>
                </table>
            </div>
            <div class="fgx"><hr></div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td>
                            <div style="display: inline-block;width: 69px">
                                <b>生命体征</b>
                            </div>
                        </td>
                        <td colspan="9">
                    <span class="smtz_span">T<input type="text" class="qt_input" id="smtzT" name="smtzT"
                                                    style="width: 30px"/>°C&nbsp;</span>
                            <span class="smtz_span">P<input type="text" class="qt_input" id="smtzP" name="smtzP"
                                                            style="width: 30px"/>次/分&nbsp;</span>
                            <span class="smtz_span">R<input type="text" class="qt_input" id="smtzR" name="smtzR"
                                                            style="width: 30px"/>次/分&nbsp;</span>
                            <span class="smtz_span">BP<input type="text" class="qt_input" id="smtzBP" name="smtzBP"
                                                             style="width: 30px"/>mmHg&nbsp;</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <span class="smtz_span">SPO<sub>2</sub><input type="text" class="qt_input" id="smtzspo2"
                                                                          name="smtzspo2" style="width: 30px"/>%&nbsp;</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="fgx"><hr></div>
            <div>
                <table class="ty_table">
                    <tr>
                        <td><b>专项评估</b></td>
                        <td colspan="9">
                        <span class="zxpg_div scorePain">
                            疼痛
                            <input class="qt_input" style="width: 30px" type="text" name="painBP-text" id="painBP" data-score="pain" tabindex="37" data-name="基本资料>疼痛>疼痛评分" data-oldvalue="" aria-invalid="false">分
                            <input type="hidden" name="painScoreId-text" id="painScoreId" value="">
                        </span>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <span class="zxpg_div scoreFall">
                        跌倒<input style="width: 30px;" type="text"  class="qt_input" data-score="humptyDumpty"
                                 name="fallscore-text" id="fallscore-text" data-oldvalue="" aria-invalid="false">分
                        </span>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <span class="zxpg_div">
                        压力性损伤<input type="text" class="qt_input" id="zxpgyc" name="zxpgyc" style="width: 30px"/>分
                       </span>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <span class="zxpg_div">
                        GCS<input type="text" class="qt_input" id="zxpgGCS" name="zxpgGCS" style="width: 30px"/>分
                       </span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="fgx"><hr></div>
            <div>
                <table style="width: 100%;table-layout: fixed">
                    <tr>
                        <td colspan="3">
                            <span>创伤部位及类型</span>
                            <input type="text" id="csjbwlx" name="csjbwlx"/>
                        </td>
                    </tr>
                    <tr>
                        <td>AV:撕裂</td>
                        <td>B: 烧伤</td>
                        <td>C: 挫伤</td>
                        <td>D: 畸形</td>
                        <td>E: 内脏切除</td>
                        <td>OF: 开放性骨折</td>
                    </tr>
                    <tr>
                        <td>CF: 闭合性骨折</td>
                        <td>G: 枪伤</td>
                        <td>L: 划破</td>
                        <td>PW: 刺伤</td>
                        <td>S: 戳伤</td>
                        <td>O: 其他</td>
                    </tr>
                </table>
            </div>
            <div class="csygql_contain">
                <div style="margin-top: 7px;margin-bottom: 4px;">
                    创伤有关情况
                </div>
                <table style="table-layout: fixed;width: 100%;border: solid 2px;word-wrap: break-word; word-break: break-all;border-spacing: 0">
                    <tr>
                        <td width="15%">创伤者身份</td>
                        <td width="15%">创伤原因</td>
                        <td width="15%">发生地点</td>
                        <td width="15%" style="border-left: solid 2px">护送方式</td>
                        <td width="15%">护送人</td>
                        <td>紧急联系</td>
                    </tr>
                    <tr>
                        <td style="border-top: solid 2px;">
                            <div>
                                <input type="checkbox" name="csygqk" id="cszsfxr" value="cszsfxr">
                                <label class="csygqk_label" for="cszsfxr">行人</label>
                            </div>
                        </td>
                        <td style="border-top: solid 2px;">
                            <div>
                                <input type="checkbox" name="csygqk" id="csyyjtyw" value="csyyjtyw">
                                <label class="csygqk_label" for="csyyjtyw">交通意外</label>
                            </div>
                        </td>
                        <td style="border-top: solid 2px;">
                            <div>
                                <input type="checkbox" name="csygqk" id="fsddjzd" value="fsddjzd">
                                <label class="csygqk_label" for="fsddjzd">居住地</label>
                            </div>
                        </td>
                        <td style="border-top: solid 2px;border-left: solid 2px">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsfszjbx" value="hsfszjbx">
                                <label class="csygqk_label" for="hsfszjbx">自己步行</label>
                            </div>
                        </td>
                        <td style="border-top: solid 2px;">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsrjs" value="hsrjs">
                                <label class="csygqk_label" for="hsrjs">家属</label>
                            </div>
                        </td>
                        <td style="border-top: solid 2px;">
                            <div>
                                <label class="csygqk_label">联系人姓名</label>
                                <input type="text" name="jjlxlxrxm" id="jjlxlxrxm" style="width: 58px;">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="cszsfmtcs" value="cszsfmtcs">
                                <label class="csygqk_label" for="cszsfmtcs">摩托车手</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="csyydqdo" value="csyydqdo">
                                <label class="csygqk_label" for="csyydqdo">钝器/殴斗</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="fsdddw" value="fsdddw">
                                <label class="csygqk_label" for="fsdddw">单位</label>
                            </div>
                        </td>
                        <td style="border-left: solid 2px">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsfsqc" value="hsfsqc">
                                <label class="csygqk_label" for="hsfsqc">汽车</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="hsrts" value="hsrts">
                                <label class="csygqk_label" for="hsrts">同事</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="cszsfqzxcr" value="cszsfqzxcr">
                                <label class="csygqk_label" for="cszsfqzxcr">骑自行车人</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="csyyqs" value="csyyqs">
                                <label class="csygqk_label" for="csyyqs">枪伤</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="fsddgd" value="fsddgd">
                                <label class="csygqk_label" for="fsddgd">工地</label>
                            </div>
                        </td>
                        <td style="border-left: solid 2px">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsfsjhc" value="hsfsjhc">
                                <label class="csygqk_label" for="hsfsjhc">救护车</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="hsrglr" value="hsrglr">
                                <label class="csygqk_label" for="hsrglr">过路人</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <label class="csygqk_label">电话</label>
                                <input type="text" name="jjlxdh" id="jjlxdh" style="width: 58px;">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="cszsfjsy" value="cszsfjsy">
                                <label class="csygqk_label" for="cszsfjsy">驾驶员</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="csyygs" value="csyygs">
                                <label class="csygqk_label" for="csyygs">工伤</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="fsddtz" value="fsddtz">
                                <label class="csygqk_label" for="fsddtz">途中</label>
                            </div>
                        </td>
                        <td style="border-left: solid 2px">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsfsslc" value="hsfsslc">
                                <label class="csygqk_label" for="hsfsslc">三轮车</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="hsrgary" value="hsrgary">
                                <label class="csygqk_label" for="hsrgary">公安人员</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="cszsfqt" value="cszsfqt">
                                <label class="csygqk_label" for="cszsfqt">其它</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="csyyzl" value="csyyzl">
                                <label class="csygqk_label" for="csyyzl">坠落</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="fsddjtgjn" value="fsddjtgjn">
                                <label class="csygqk_label" for="fsddjtgjn">交通工具内</label>
                            </div>
                        </td>
                        <td style="border-left: solid 2px">
                            <div>
                                <input type="checkbox" name="csygqk" id="hsfsjc" value="hsfsjc">
                                <label class="csygqk_label" for="hsfsjc">警车</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="hsrywry" value="hsrywry">
                                <label class="csygqk_label" for="hsrywry">医务人员</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="csyyqt" value="csyyqt">
                                <label class="csygqk_label" for="csyyqt">其他</label>
                            </div>
                        </td>
                        <td>
                            <div>
                                <input type="checkbox" name="csygqk" id="fsddqt" value="fsddqt">
                                <label class="csygqk_label" for="fsddqt">其他</label>
                            </div>
                        </td>
                        <td style="border-left: solid 2px"></td>
                        <td></td>
                        <td>
                            <label class="csygqk_label">欠款:&nbsp;</label><input type="checkbox" name="csygqk" id="qky"
                                                                                value="qky">
                            <label class="csygqk_label" for="qky">有</label>
                            <input type="checkbox" name="csygqk" id="qkw" value="qkw">
                            <label class="csygqk_label" for="qkw">无</label>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="hhl_button">
                <button class="btn-emr btn-emr-green save_button" id="save">保存</button>
                <button class="btn-emr btn-emr-green" id="print">打印</button>
            </div>
            <div>
                <input type="text" style="display: none" id="recordId"/>
            </div>
        </div>
    </div>

</div>

</body>
<script>
    (function ($) {
        let Page = {};
        var argUrl = getRequestUrl(window.location.href);
        Page.Event = {
            staff: {//登录人信息
                name: $('#inpatientName ').text(),
                staffid: $('.member-info-body p', parent.document).data('staffid'),
                wardcode: $(".member-info-name").attr("data-wardcode"),
                hospital_id: $(".member-info-name").data("hospitalid"),
                bedNum: $("#bedNumber").text(),
                age: $('.icon-age', parent.document).text()
            },
            init: function () {
                this.getDetail()
                $("#name").text(Page.Event.staff.name)
                $("#sex").text($("#inpatientGender").val())
                $("#age").text(Page.Event.staff.age)
                $("#bednum2").text(Page.Event.staff.bedNum)
                $("#innum").text($("#patientNum").text() || '')
                this.pageEvent()
            },
            pageEvent: function () {
                let that = this;
                $("input[name='date']").on('click', function () {
                    WdatePicker({
                        dateFmt: 'yyyy-MM-dd HH:mm'
                    });
                });
                $("button[id='save']").on('click', function () {
                    that.save();
                });
                $("button[id='print']").on('click', function () {
                    that.print();
                })
            },
            save: function () {
                let save = {};
                let that = this;
                //输入信息保存
                $("input[type='text']").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                });
                //多选信息保存
                $("input[type='checkbox']:checked").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                })
                //单选信息保存
                $("input[type='radio']:checked").each(function () {
                    save[$(this).attr('id')] = $(this).val()
                })
                _args = {
                    inpatientId:argUrl.inpatientId,
                    hospitalId: Page.Event.staff.hospital_id,
                    assessmentType: 'jzcsjlb_o',
                    assessmentTime: new Date().Format("yyyy-MM-dd,hh:mm:ss"),
                    assessmentId: Page.Event.staff.staffid,
                    assessmentName: Page.Event.staff.name,
                    assessmentDetail: JSON.stringify(save),
                }
                if ($("#recordId").val()) {
                    _args['assessmentDataId'] = $("#recordId").val()
                    that.saveItem('/template/cnStructuredCustomData/update', _args)
                } else {
                    that.saveItem('/template/cnStructuredCustomData/save', _args)

                }
                console.log(_args);
            },
            //调取保存或者修改接口
            saveItem: function (url, param) {
                let that = this
                $.ajax({
                    url: url,
                    async: false,
                    type: 'POST',
                    contentType: "application/json;charset-utf-8",
                    data: JSON.stringify(param),
                    success: function (res) {
                        if (res.state == 200) {
                            layer.msg('保存成功')
                            that.getDetail()
                        }
                    },
                    error: function (msg) {
                        layer.error("保存发生异常!", msg.responseText);
                    }
                });
            },
            //获取详情
            getDetail: function () {
                $.ajax({
                    type: "get",
                    url: '/template/cnStructuredCustomData/getListByCondition',
                    data: {
                        inpatientId: argUrl.inpatientId,
                        assessmentType: "jzcsjlb_o",
                    },
                    contentType: "application/json;charset=utf-8"
                }).done(function (res) {
                    if (res.state == 200) {
                        if (res.results.result && res.results.result.length > 0) {
                            $("#recordId").val(res.results.result[0].assessmentDataId)
                            let dataItem = JSON.parse(res.results.result[0].assessmentDetail)
                            //数据回显
                            for (let key in dataItem) {
                                //输入信息保存
                                $("input[type='text']").each(function () {
                                    if ($(this).attr('id') == key && key != 'recordId') {
                                        $(this).val(dataItem[key])
                                        $(this).attr('value', dataItem[key])
                                    }
                                })
                                //勾选信息保存
                                $("input[type='checkbox']").each(function () {
                                    if ($(this).attr('id') == key) {
                                        $(this).prop('checked', true)
                                        $(this).attr('checked', 'checked')
                                    }
                                })
                                //单选信息保存
                                $("input[type='radio']").each(function () {
                                    if ($(this).attr('id') == key) {
                                        $(this).prop('checked', true)
                                        $(this).attr('checked', 'checked')
                                    }
                                })
                            }
                        }
                    }
                })
            },
            print: function () {
                var _style = $($("#hideHtml input[name='hidePrintHtml']")[0]).val();
                let _html = $("#printBody").html()
                LODOP.PRINT_INIT("");
                LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4");
                // LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
                // SET_PRINT_MODE("PRINT_PAGE_PERCENT",'Full-Width');
                LODOP.ADD_PRINT_HTM('5%', '10%', '100%', '90%', _style + _html)
                // LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
                LODOP.ADD_PRINT_TEXT("98%", "48%", 300, 30, "第#页")
                LODOP.SET_PRINT_STYLEA(0, "ItemType", 2, "FontSize", 12);
                // LODOP.PRINT_DESIGN();
                LODOP.PREVIEW();


                LODOP.PRINT_INIT("");
                LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4"); //A4 width=210mm,height=297mm
                //页眉
                // LODOP.ADD_PRINT_HTM("1%", "6%", "85%", 130, pageHead);
                LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
                //参数：top  left width  height url
                LODOP.ADD_PRINT_HTM("10%", "3%", "90%", "80%",_style+ _html);
                // LODOP.ADD_PRINT_TABLE(128, "5%", "90%", 328, strStyle+printData)
                LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
                LODOP.SET_PRINT_STYLEA(0, "Herient", 2);
                LODOP.SET_PRINT_STYLEA(0, "Verient", 2);
                LODOP.SET_SHOW_MODE("HIDE_PAPER_BOARD", 1);
                LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); //HIDE_PAPER_BOARD
                //页脚
                LODOP.ADD_PRINT_TEXT("98%", "48%", 100, 22, "第#页/共&页");
                LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
                LODOP.PREVIEW();
                // LODOP.PRINT_DESIGN();
            }

        }
        Page.Event.init();
        var staff = {
            id: $('.member-info-body p').data('staffid'),
            name: $('.member-info-body p').text()
        };
        var location_href = window.location.href;
        var arg = handleUrl(location_href);
        var bradenQBorder = parseInt(window.localStorage.getItem('bradenQ年龄界限'));
        var ageString = $('.icon-age').text();
        var age = 0;
        if (ageString.indexOf('月') > 0 ||
            ageString.indexOf('星期') > 0 ||
            ageString.indexOf('天') > 0 ||
            ageString.indexOf('日') > 0 ||
            ageString.indexOf('小时') > 0) {
            age = 1;
        } else {
            age = ageString.replace(/[^0-9]/ig, "");
            age = parseInt(age);
        }
        var score = {
            dataUrl: {
                braden: '/score/braden',
                adl: '/score/adl',
                gcs: '/score/gcs',
                pain: '/score/pain',
                bradenQ: '/score/bradenQ',
                fall: '/score/fall',
                humptyDumpty: '/score/humptyDumpty',
                childfallbed: '/score/childfallbed'
            },
            dataTitle: {
                braden: 'braden评分',
                adl: 'ADL评分',
                gcs: 'GCS评分',
                pain: '疼痛评分',
                bradenQ: 'Braden Q scale评分',
                fall: '跌倒/坠床危险评分',
                childfallbed: '小儿坠床/跌倒评分',
                humptyDumpty: 'Humpty Dumpty儿童跌倒风险评分'
            },
            init: function () {
                this.event();
            },
            openScoreIframe: function (title, url, style) {
                var patientNum = $("#bednum").text();
                var age = $('.icon-age').text();
                var bedNumber = $("#bedNumber").text();
                var patientName = $("#inpatientName").text();
                $.index = layer.open({
                    type: 2,
                    title: '<div>' + title + '<span style="margin-left: 50px;font-size:13px">姓名:</span><span style="font-size:13px">' + patientName + '<span style="margin-left: 50px;font-size:13px">年龄:</span><span style="font-size:13px">' + age + '</span><span style="margin-left: 50px;font-size:13px">病历号:</span><span style="font-size:13px">' + patientNum + '</span><span  style="margin-left: 50px;font-size:13px">床号:</span><span style="font-size:13px">' + bedNumber + '</span></div>',
                    content: url,
                    scrollbar: false,
                    shift: "",
                    area: style,
                    success: function () {//成功后的回调函数
                    },
                    'zIndex': '208'
                });
            },
            event: function () {
                var that = this;
                $('#printBody').on('click', '[data-score]', function (event) {
                    var scoreid;
                    var scoreName = $(this).attr('data-score');
                    var come = "action";
                    scoreid = $('[name="' + scoreName + 'ScoreId-text"]').val();
                    if (!scoreName) {
                        return false;
                    }
                    if (age <= bradenQBorder && scoreName == 'fall') {
                        scoreName = 'childfallbed';
                    }
                    var title = (that.dataTitle)[scoreName];
                    var url = (that.dataUrl)[scoreName] + '?inpatientId=' + arg.inpatientId + '&username=' + encodeURI(staff.name)
                        + '&userid=' + staff.id + '&inpatient_id=' + arg.inpatientId + '&score_type=' + scoreName;
                    if (come) {
                        url = url + '&come=' + come;
                    }
                    if (scoreid) {
                        url = url + '&scoreid=' + scoreid;
                    }
                    var area = ['850px', '560px'];
                    if (scoreName == 'bradenQ') {
                        area = ['920px', '510px;'];
                    }
                    if (scoreName == 'gcs') {
                        area = ['920px', '530px;'];
                    }
                    if (scoreName == 'braden') {
                        area = ['860px', '470px;'];
                    }
                    if (scoreName == 'adl') {
                        area = ['920px', '700px;'];
                    }
                    if (scoreName == 'lost') {
                        area = ['950px', '560px;'];
                    }
                    if (scoreName == 'fall') {
                        area = ['950px', '700px;'];
                    }
                    if (scoreName == 'childfallbed') {
                        area = ['850px', '600px;'];
                    }
                    if (scoreName == 'pain') {
                        url = url + '&next=Measures';
                        area = ['950px', '750px;'];
                    }
                    if (scoreName == 'humptyDumpty') {
                        area = ['950px', '700px;'];
                    }
                    if ($(this).attr('data-temp') && $(this).attr('data-temp') == 'allAssessTemplate') {//如果是评分模板入口直接return false（initScoreTem()方法在common.js）
                        initScoreTem($(this));
                        return false;
                    }
                    that.openScoreIframe(title, url, area);//打开评分页面
                    return false;
                });
            }
        };
        score.init();
    })(jQuery);
</script>
</html>
